package com.scnu.edu.config;

import com.scnu.edu.entity.Order;
import lombok.Data;

import java.math.BigDecimal;

@Data
public class OrderModel {
    private Long id;
    private String orderNo;
    private Long userId;
    private String productId;
    private String productName;
    private BigDecimal amount;
    private Integer payType;
    private Integer status;
    private Integer vipDays;

    // 商品相关信息（假设）
    private IdleItem idleItem;

    // 从Order实体转换为OrderModel
    public static OrderModel fromOrder(Order order) {
        OrderModel model = new OrderModel();
        model.setId(order.getId());
        model.setOrderNo(order.getOrderNo());
        model.setUserId(order.getUserId());
        model.setProductName(order.getProductName());
        model.setAmount(order.getAmount());
        model.setVipDays(order.getVipDays());
        return model;
    }

    // 商品信息内部类（假设）
    @Data
    public static class IdleItem {
        private String idleName;
        private BigDecimal price;
        // 其他商品属性
    }
}